package net.pws.oos.web.dto;

import java.util.HashMap;
import java.util.Map;

import net.pws.common.security.spi.resource.Resource;

import org.apache.commons.beanutils.PropertyUtils;

public class ResourceTreeNodeDto {
    
    public static ResourceTreeNodeDto from(Resource resource) {
        ResourceTreeNodeDto result = new ResourceTreeNodeDto();
        try {
            result.metadata = PropertyUtils.describe(resource);
        }
        catch (Exception e) {
        }
        result.setData(resource.getName());
        return result;
    }
    
    private String data;
    
    private Map metadata = new HashMap();
    
    private String state = "closed";
    
    public String getData() {
        return data;
    }
    
    public void setData(String title) {
        this.data = title;
    }
    
    public String getState() {
        return state;
    }
    
    public Map getMetadata() {
        return metadata;
    }
    
}
